<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>接受微博</title>
<script src="/js/jquery/jquery.js"></script>
</head>
<body>

<div class="choose">
<input type=radio name="accept" value =1>接受
<input type=radio name="accept" value =0>拒绝
</div>
<!-- <div class="detail_choose">
<input type=radio name="need_type" value ="1">评论
<input type=radio name="need_type" value ="2">@次数
<input type="text" id ="need_num" name="need_num">
</div>
 -->
<input type="hidden" id="request_id" value="{%$g_show.id%}">
<input type="button" class="form_submit" value="确认">
<script>
$(".choose").bind("click",function(e){
	var accept= $(e.target).val();
	if(accept == 0)
	{
		$(".detail_choose").hide();
	}
	else
	{
		$(".detail_choose").show();
	}	
})

$(".form_submit").bind("click",function(e){
	
var accept = $(".choose").find(":radio:checked").val();	

var need_type = $(".detail_choose").find(":radio:checked").val();

var request_id = $("#request_id").val();
var need_num = $("#need_num").val();
	$.ajax({
		url:"answer_post.php",
		type:"post",
		data:"id="+request_id+"&need_type="+need_type+"&accept="+accept+"&need_num="+need_num,
		dataType:"json",
		complete:function(xhr,txtStatus){
			if(txtStatus == "success"){
				var result = eval("("+xhr.responseText+")");

				if(result.error == "0"){
					alert("success")	
				}else{
					alert(result.errmsg)	
				}
				
			}else{
				alert("request fail")	
			}
		}
	});

	
})
</script>
</body>
</html>		
		